#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
#     http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# ******************************************************************************/
from email.policy import default

import click
from core.build import BuildVerify


@click.command("build", help="编译软件包")
# @click.option("-p", "--package", help="软件包名称")
# 是否会重复（上传），固定一个容器中上传
@click.option(
    "-a",
    "--arch",
    help="软件架构",
    type=click.Choice(["x86", "aarch64"], case_sensitive=False),
    default="x86",
    show_default=True,
    required=True,
)
@click.option("-pr", "--pull-request", help="pr的完整url")
@click.option("-tb", "--target-branch", help="pr的目标分支")
@click.option("-a", "--arch", help="软件包编译环境架构")
@click.option("-p", "--packages", help="需要验证的包列表")
@click.option("--multiple/--no-multiple", default=False, help="多个软件包编译,默认单包编译")
@click.option("--ignore/--no-ignore", default=False, help="是否忽略多包验证的结果")
# @click.option("-c", "--code", help="代码的路径")  后续拼接
# @click.option("-w", "--workspace", help="osc的工作目录", envvar="OSC_WORKSPACE") 有常量
# 上报kafka时使用
# @click.option("-id", "--comment-id", "comment_id", help="评论id")  单独步骤处理
# @click.option("-r", "--repo", help="repo")
# @click.option("-u", "--user", help="码云的账号")
# @click.option("-o", "--owner", help="src-openeuler仓库")  固定的src-openeuler
# @click.option("--spec", "spec", help="spec文件")
def build(pull_request, target_branch, arch, packages, multiple, no_ignore):
    click.echo("[INFO] start check build")

    build_obj = BuildVerify(pull_request, target_branch,
                            arch, packages, multiple, no_ignore)


__all__ = "build"
